home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Graphics Plus
/
Graphics Plus.iso
/
amiga
/
gui
/
prcgntn1.lha
/
Precognition
/
source
/
precognition3d.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-12-23
|
5KB
|
167 lines
#include "precognition3d.h"
#include "precognition_utils.h"
#include <proto/exec.h>
#include <proto/intuition.h>
#include <proto/graphics.h>
#include "amigamem.h"
pcg_3DPens Std_v20_pens = { 1, 0, 2, 1 };
pcg_3DPens Std_v13_pens = { 1, 0, 1, 2 };
pcg_3DPens StandardPens( void )
{
return (is_Workbench_v2()) ? Std_v20_pens : Std_v13_pens;
}
void pcg_Init3DBox( pcg_3DBox *Box,
SHORT LeftEdge,
SHORT TopEdge,
USHORT Width,
USHORT Height,
UBYTE TopLeftPen,
UBYTE BottomRightPen,
Border *NextBorder )
{
SHORT Wm1, Wm2, Hm1, Hm2;
Box->TopLeft.LeftEdge = LeftEdge;
Box->TopLeft.TopEdge = TopEdge;
Box->TopLeft.FrontPen = TopLeftPen;
Box->TopLeft.DrawMode = JAM1;
Box->TopLeft.NextBorder = &Box->BottomRight;
Box->BottomRight.LeftEdge = LeftEdge;
Box->BottomRight.TopEdge = TopEdge;
Box->BottomRight.FrontPen = BottomRightPen;
Box->BottomRight.DrawMode = JAM1;
Box->BottomRight.NextBorder = NextBorder;
Wm1 = Width-1;
Wm2 = Width-2;
Hm1 = Height-1;
Hm2 = Height-2;
Box->Points[ 0] = Wm1;
Box->Points[ 1] = 0;
Box->Points[ 2] = 0;
Box->Points[ 3] = 0;
Box->Points[ 4] = 0;
Box->Points[ 5] = Hm1;
Box->Points[ 6] = 1;
Box->Points[ 7] = Hm2;
Box->Points[ 8] = 1;
Box->Points[ 9] = 1;
Box->Points[10] = 1;
Box->Points[11] = Hm1;
Box->Points[12] = Wm1;
Box->Points[13] = Hm1;
Box->Points[14] = Wm1;
Box->Points[15] = 0;
Box->Points[16] = Wm2;
Box->Points[17] = 1;
Box->Points[18] = Wm2;
Box->Points[19] = Hm2;
Box->TopLeft.Count = 5;
Box->TopLeft.XY = (SHORT *) &Box->Points[0];
Box->BottomRight.Count = 5;
Box->BottomRight.XY = (SHORT *) &Box->Points[10];
}
void pcg_Init3DBevel( pcg_3DBevel *Bevel,
SHORT LeftEdge,
SHORT TopEdge,
USHORT Width,
USHORT Height,
USHORT BevelWidth,
UBYTE TopLeftPen,
UBYTE BottomRightPen,
Border *NextBorder )
{
pcg_Init3DBox( &Bevel->Outer,
LeftEdge, TopEdge,
Width, Height,
TopLeftPen, BottomRightPen,
&Bevel->Inner.TopLeft );
pcg_Init3DBox( &Bevel->Inner,
LeftEdge+2, TopEdge+1,
Width-4-BevelWidth, Height-2-BevelWidth,
BottomRightPen, TopLeftPen,
NextBorder );
}
typedef struct pcg_DoubleBorder
{
Border b1, b2;
} pcg_DoubleBorder;
void pcg_Init3DThinBox( pcg_DoubleBorder *db,
SHORT LeftEdge,
SHORT TopEdge,
USHORT Width,
USHORT Height,
SHORT *Points,
UBYTE TopLeftPen,
UBYTE BottomRightPen,
Border *NextBorder )
{
SHORT Wm1, Hm1;
db->b1.LeftEdge = db->b2.LeftEdge = LeftEdge;
db->b1.TopEdge = db->b2.TopEdge = TopEdge;
db->b1.DrawMode = db->b2.DrawMode = JAM1;
db->b1.FrontPen = TopLeftPen;
db->b2.FrontPen = BottomRightPen;
db->b1.NextBorder = &db->b2;
db->b2.NextBorder = NextBorder;
db->b1.XY = &Points[0];
db->b1.Count = 3;
db->b2.XY = &Points[4];
db->b2.Count = 3;
Wm1 = Width-1;
Hm1 = Height-1;
Points[ 0] = Wm1;
Points[ 1] = 0;
Points[ 2] = 0;
Points[ 3] = 0;
Points[ 4] = 0;
Points[ 5] = Hm1;
Points[ 6] = Wm1;
Points[ 7] = Hm1;
Points[ 8] = Wm1;
Points[ 9] = 0;
}
void pcg_Init3DThinBevel( pcg_3DThinBevel *Bevel,
SHORT LeftEdge,
SHORT TopEdge,
USHORT Width,
USHORT Height,
USHORT BevelWidth,
UBYTE TopLeftPen,
UBYTE BottomRightPen,
Border *NextBorder )
{
pcg_Init3DThinBox( (pcg_DoubleBorder*) &Bevel->b[0],
LeftEdge, TopEdge,
Width, Height,
&Bevel->Points[0],
TopLeftPen, BottomRightPen,
&Bevel->b[2] );
pcg_Init3DThinBox( (pcg_DoubleBorder*) &Bevel->b[2],
LeftEdge+1, TopEdge+1,
Width-2-BevelWidth, Height-2-BevelWidth,
&Bevel->Points[10],
BottomRightPen, TopLeftPen,
NextBorder );
}